home *** CD-ROM | disk | FTP | other *** search
/ The Very Best of Atari Inside / The Very Best of Atari Inside 1.iso / mint / mint110s / file.h < prev    next >
C/C++ Source or Header  |  1994-02-15  |  19KB  |  578 lines

  1. /*
  2. Copyright 1991,1992 Eric R. Smith.
  3. Copyright 1992,1993,1994 Atari Corporation.
  4. All rights reserved.
  5. */
  6.  
  7. #ifndef _filesys_h
  8. #define _filesys_h
  9.  
  10. struct filesys;        /* forward declaration */
  11. struct devdrv;        /* ditto */
  12. struct timeout;        /* and ditto */
  13.  
  14. typedef struct f_cookie {
  15.     struct filesys *fs;    /* filesystem that knows about this cookie */
  16.     ushort    dev;        /* device info (e.g. Rwabs device number) */
  17.     ushort    aux;        /* extra data that the file system may want */
  18.     long    index;        /* this+dev uniquely identifies a file */
  19. } fcookie;
  20.  
  21. #define TOS_NAMELEN 13
  22.  
  23. typedef struct dtabuf {
  24.     short    index;        /* index into arrays in the PROC struct */
  25.     long    magic;
  26. #define SVALID    0x1234fedcL    /* magic for a valid search */
  27. #define EVALID    0x5678ba90L    /* magic for an exhausted search */
  28.  
  29.     char    dta_pat[TOS_NAMELEN+1];    /* pointer to pattern, if necessary */
  30.     char    dta_sattrib;    /* attributes being searched for */
  31. /* this stuff is returned to the user */
  32.     char    dta_attrib;
  33.     short    dta_time;
  34.     short    dta_date;
  35.     long    dta_size;
  36.     char    dta_name[TOS_NAMELEN+1];
  37. } DTABUF;
  38.  
  39. /* structure for opendir/readdir/closedir */
  40. typedef struct dirstruct {
  41.     fcookie fc;        /* cookie for this directory */
  42.     ushort    index;        /* index of the current entry */
  43.     ushort    flags;        /* flags (e.g. tos or not) */
  44. #define TOS_SEARCH    0x01
  45.     char    fsstuff[60];    /* anything else the file system wants */
  46.                 /* NOTE: this must be at least 45 bytes */
  47.     struct dirstruct *next;    /* linked together so we can close them
  48.                    on process termination */
  49. } DIR;
  50.  
  51. /* structure for getxattr */
  52. typedef struct xattr {
  53.     ushort    mode;
  54. /* file types */
  55. #define S_IFMT    0170000        /* mask to select file type */
  56. #define S_IFCHR    0020000        /* BIOS special file */
  57. #define S_IFDIR    0040000        /* directory file */
  58. #define S_IFREG 0100000        /* regular file */
  59. #define S_IFIFO 0120000        /* FIFO */
  60. #define S_IMEM    0140000        /* memory region or process */
  61. #define S_IFLNK    0160000        /* symbolic link */
  62.  
  63. /* special bits: setuid, setgid, sticky bit */
  64. #define S_ISUID    04000
  65. #define S_ISGID 02000
  66. #define S_ISVTX    01000
  67.  
  68. /* file access modes for user, group, and other*/
  69. #define S_IRUSR    0400
  70. #define S_IWUSR 0200
  71. #define S_IXUSR 0100
  72. #define S_IRGRP 0040
  73. #define S_IWGRP    0020
  74. #define S_IXGRP    0010
  75. #define S_IROTH    0004
  76. #define S_IWOTH    0002
  77. #define S_IXOTH    0001
  78. #define DEFAULT_DIRMODE (0777)
  79. #define DEFAULT_MODE    (0666)
  80.     long    index;
  81.     ushort    dev;
  82.     ushort    rdev;        /* "real" device */
  83.     ushort    nlink;
  84.     ushort    uid;
  85.     ushort    gid;
  86.     long    size;
  87.     long    blksize;
  88.     long    nblocks;
  89.     short    mtime, mdate;
  90.     short    atime, adate;
  91.     short    ctime, cdate;
  92.     short    attr;
  93. /* defines for TOS attribute bytes */
  94. #ifndef FA_RDONLY
  95. #define           FA_RDONLY           0x01
  96. #define           FA_HIDDEN           0x02
  97. #define           FA_SYSTEM           0x04
  98. #define           FA_LABEL               0x08
  99. #define           FA_DIR               0x10
  100. #define           FA_CHANGED           0x20
  101. #endif
  102.     short    reserved2;
  103.     long    reserved3[2];
  104. } XATTR;
  105.  
  106. typedef struct fileptr {
  107.     short    links;        /* number of copies of this descriptor */
  108.     ushort    flags;        /* file open mode and other file flags */
  109.     long    pos;        /* position in file */
  110.     long    devinfo;    /* device driver specific info */
  111.     fcookie    fc;        /* file system cookie for this file */
  112.     struct devdrv *dev; /* device driver that knows how to deal with this */
  113.     struct fileptr *next; /* link to next fileptr for this file */
  114. } FILEPTR;
  115.  
  116. struct flock {
  117.     short l_type;            /* type of lock */
  118. #define F_RDLCK        0
  119. #define F_WRLCK        1
  120. #define F_UNLCK        3
  121.     short l_whence;            /* SEEK_SET, SEEK_CUR, SEEK_END */
  122.     long l_start;            /* start of locked region */
  123.     long l_len;            /* length of locked region */
  124.     short l_pid;            /* pid of locking process
  125.                         (F_GETLK only) */
  126. };
  127.  
  128. /* structure for internal kernel locks */
  129. typedef struct ilock {
  130.     struct flock l;        /* the actual lock */
  131.     struct ilock *next;    /* next lock in the list */
  132.     long    reserved[4];    /* reserved for future expansion */
  133. } LOCK;
  134.  
  135. typedef struct devdrv {
  136.     long ARGS_ON_STACK (*open)    P_((FILEPTR *f));
  137.     long ARGS_ON_STACK (*write)    P_((FILEPTR *f, const char *buf, long bytes));
  138.     long ARGS_ON_STACK (*read)    P_((FILEPTR *f, char *buf, long bytes));
  139.     long ARGS_ON_STACK (*lseek)    P_((FILEPTR *f, long where, int whence));
  140.     long ARGS_ON_STACK (*ioctl)    P_((FILEPTR *f, int mode, void *buf));
  141.     long ARGS_ON_STACK (*datime)    P_((FILEPTR *f, short *timeptr, int rwflag));
  142.     long ARGS_ON_STACK (*close)    P_((FILEPTR *f, int pid));
  143.     long ARGS_ON_STACK (*select)    P_((FILEPTR *f, long proc, int mode));
  144.     void ARGS_ON_STACK (*unselect) P_((FILEPTR *f, long proc, int mode));
  145. } DEVDRV;
  146.  
  147. typedef struct filesys {
  148.     struct    filesys    *next;    /* link to next file system on chain */
  149.     long    fsflags;
  150. #define FS_KNOPARSE    0x01    /* kernel shouldn't do parsing */
  151. #define FS_CASESENSITIVE    0x02    /* file names are case sensitive */
  152. #define FS_NOXBIT    0x04    /* if a file can be read, it can be executed */
  153. #define    FS_LONGPATH    0x08    /* file system understands "size" argument to
  154.                    "getname" */
  155.     long    ARGS_ON_STACK (*root) P_((int drv, fcookie *fc));
  156.     long    ARGS_ON_STACK (*lookup) P_((fcookie *dir, const char *name, fcookie *fc));
  157.     long    ARGS_ON_STACK (*creat) P_((fcookie *dir, const char *name, unsigned mode,
  158.                 int attrib, fcookie *fc));
  159.     DEVDRV * ARGS_ON_STACK (*getdev) P_((fcookie *fc, long *devspecial));
  160.     long    ARGS_ON_STACK (*getxattr) P_((fcookie *file, XATTR *xattr));
  161.     long    ARGS_ON_STACK (*chattr) P_((fcookie *file, int attr));
  162.     long    ARGS_ON_STACK (*chown) P_((fcookie *file, int uid, int gid));
  163.     long    ARGS_ON_STACK (*chmode) P_((fcookie *file, unsigned mode));
  164.     long    ARGS_ON_STACK (*mkdir) P_((fcookie *dir, const char *name, unsigned mode));
  165.     long    ARGS_ON_STACK (*rmdir) P_((fcookie *dir, const char *name));
  166.     long    ARGS_ON_STACK (*remove) P_((fcookie *dir, const char *name));
  167.     long    ARGS_ON_STACK (*getname) P_((fcookie *relto, fcookie *dir,
  168.                 char *pathname, int size));
  169.     long    ARGS_ON_STACK (*rename) P_((fcookie *olddir, char *oldname,
  170.                 fcookie *newdir, const char *newname));
  171.     long    ARGS_ON_STACK (*opendir) P_((DIR *dirh, int tosflag));
  172.     long    ARGS_ON_STACK (*readdir) P_((DIR *dirh, char *name, int namelen, fcookie *fc));
  173.     long    ARGS_ON_STACK (*rewinddir) P_((DIR *dirh));
  174.     long    ARGS_ON_STACK (*closedir) P_((DIR *dirh));
  175.     long    ARGS_ON_STACK (*pathconf) P_((fcookie *dir, int which));
  176.     long    ARGS_ON_STACK (*dfree) P_((fcookie *dir, long *buf));
  177.     long    ARGS_ON_STACK (*writelabel) P_((fcookie *dir, const char *name));
  178.     long    ARGS_ON_STACK (*readlabel) P_((fcookie *dir, char *name, int namelen));
  179.     long    ARGS_ON_STACK (*symlink) P_((fcookie *dir, const char *name, const char *to));
  180.     long    ARGS_ON_STACK (*readlink) P_((fcookie *dir, char *buf, int len));
  181.     long    ARGS_ON_STACK (*hardlink) P_((fcookie *fromdir, const char *fromname,
  182.                 fcookie *todir, const char *toname));
  183.     long    ARGS_ON_STACK (*fscntl) P_((fcookie *dir, const char *name, int cmd, long arg));
  184.     long    ARGS_ON_STACK (*dskchng) P_((int drv));
  185.     long    ARGS_ON_STACK (*release) P_((fcookie *));
  186.     long    ARGS_ON_STACK (*dupcookie) P_((fcookie *new, fcookie *old));
  187. } FILESYS;
  188.  
  189. /*
  190.  * this is the structure passed to loaded file systems to tell them
  191.  * about the kernel
  192.  */
  193.  
  194. struct kerinfo {
  195.     short    maj_version;    /* kernel version number */
  196.     short    min_version;    /* minor kernel version number */
  197.     ushort    default_perm;    /* default file permissions */
  198.     short    reserved1;    /* room for expansion */
  199.  
  200. /* OS functions */
  201.     Func    *bios_tab;    /* pointer to the BIOS entry points */
  202.     Func    *dos_tab;    /* pointer to the GEMDOS entry points */
  203.  
  204. /* media change vector */
  205.     void    ARGS_ON_STACK (*drvchng) P_((unsigned));
  206.  
  207. /* Debugging stuff */
  208.     void    ARGS_ON_STACK (*trace) P_((const char *, ...));
  209.     void    ARGS_ON_STACK (*debug) P_((const char *, ...));
  210.     void    ARGS_ON_STACK (*alert) P_((const char *, ...));
  211.     EXITING void ARGS_ON_STACK (*fatal) P_((const char *, ...));
  212.  
  213. /* memory allocation functions */
  214.     void *    ARGS_ON_STACK (*kmalloc) P_((long));
  215.     void    ARGS_ON_STACK (*kfree) P_((void *));
  216.     void *    ARGS_ON_STACK (*umalloc) P_((long));
  217.     void    ARGS_ON_STACK (*ufree) P_((void *));
  218.  
  219. /* utility functions for string manipulation */
  220.     int    ARGS_ON_STACK (*strnicmp) P_((const char *, const char *, int));
  221.     int    ARGS_ON_STACK (*stricmp) P_((const char *, const char *));
  222.     char *    ARGS_ON_STACK (*strlwr) P_((char *));
  223.     char *    ARGS_ON_STACK (*strupr) P_((char *));
  224.     int    ARGS_ON_STACK (*sprintf) P_((char *, const char *, ...));
  225.  
  226. /* utility functions for manipulating time */
  227.     void    ARGS_ON_STACK (*millis_time) P_((unsigned long, short *));
  228.     long    ARGS_ON_STACK (*unixtim) P_((unsigned, unsigned));
  229.     long    ARGS_ON_STACK (*dostim) P_((long));
  230.  
  231. /* utility functions for dealing with pauses, or for putting processes
  232.  * to sleep
  233.  */
  234.     void    ARGS_ON_STACK (*nap) P_((unsigned));
  235.     int    ARGS_ON_STACK (*sleep) P_((int que, long cond));
  236.     void    ARGS_ON_STACK (*wake) P_((int que, long cond));
  237.     void    ARGS_ON_STACK (*wakeselect) P_((long param));
  238.  
  239. /* file system utility functions */
  240.     int    ARGS_ON_STACK (*denyshare) P_((FILEPTR *, FILEPTR *));
  241.     LOCK *    ARGS_ON_STACK (*denylock) P_((LOCK *, LOCK *));
  242.  
  243. /* functions for adding/cancelling timeouts */
  244.     struct timeout * ARGS_ON_STACK (*addtimeout) P_((long, void (*)()));
  245.     void    ARGS_ON_STACK (*canceltimeout) P_((struct timeout *));
  246.  
  247. /* reserved for future use */
  248.     long    res2[7];
  249. };
  250.  
  251. /* flags for open() modes */
  252. #define O_RWMODE      0x03    /* isolates file read/write mode */
  253. #    define O_RDONLY    0x00
  254. #    define O_WRONLY    0x01
  255. #    define O_RDWR    0x02
  256. #    define O_EXEC    0x03    /* execute file; used by kernel only */
  257.  
  258. /* 0x04 is for future expansion */
  259. #define O_APPEND    0x08    /* all writes go to end of file */
  260.  
  261. #define O_SHMODE    0x70    /* isolates file sharing mode */
  262. #    define O_COMPAT    0x00    /* compatibility mode */
  263. #    define O_DENYRW    0x10    /* deny both read and write access */
  264. #    define O_DENYW    0x20    /* deny write access to others */
  265. #    define O_DENYR    0x30    /* deny read access to others */
  266. #    define O_DENYNONE 0x40    /* don't deny any access to others */
  267.  
  268. #define O_NOINHERIT    0x80    /* private file (not passed to child) */
  269.  
  270. #define O_NDELAY    0x100    /* don't block for i/o on this file */
  271. #define O_CREAT        0x200    /* create file if it doesn't exist */
  272. #define O_TRUNC        0x400    /* truncate file to 0 bytes if it does exist */
  273. #define O_EXCL        0x800    /* fail open if file exists */
  274.  
  275. #define O_USER        0x0fff    /* isolates user-settable flag bits */
  276.  
  277. #define O_GLOBAL    0x1000    /* for opening a global file */
  278.  
  279. /* kernel mode bits -- the user can't set these! */
  280. #define O_TTY        0x2000
  281. #define O_HEAD        0x4000
  282. #define O_LOCK        0x8000
  283.  
  284. /* GEMDOS file attributes */
  285.  
  286. /* macros to be applied to FILEPTRS to determine their type */
  287. #define is_terminal(f) (f->flags & O_TTY)
  288.  
  289. /* lseek() origins */
  290. #define    SEEK_SET    0        /* from beginning of file */
  291. #define    SEEK_CUR    1        /* from current location */
  292. #define    SEEK_END    2        /* from end of file */
  293.  
  294. /* The requests for Dpathconf() */
  295. #define DP_IOPEN    0    /* internal limit on # of open files */
  296. #define DP_MAXLINKS    1    /* max number of hard links to a file */
  297. #define DP_PATHMAX    2    /* max path name length */
  298. #define DP_NAMEMAX    3    /* max length of an individual file name */
  299. #define DP_ATOMIC    4    /* # of bytes that can be written atomically */
  300. #define DP_TRUNC    5    /* file name truncation behavior */
  301. #    define    DP_NOTRUNC    0    /* long filenames give an error */
  302. #    define    DP_AUTOTRUNC    1    /* long filenames truncated */
  303. #    define    DP_DOSTRUNC    2    /* DOS truncation rules in effect */
  304. #define DP_CASE        6
  305. #    define    DP_CASESENS    0    /* case sensitive */
  306. #    define    DP_CASECONV    1    /* case always converted */
  307. #    define    DP_CASEINSENS    2    /* case insensitive, preserved */
  308. #define DP_MAXREQ    6    /* highest legal request */
  309.  
  310. /* Dpathconf and Sysconf return this when a value is not limited
  311.    (or is limited only by available memory) */
  312.  
  313. #define UNLIMITED    0x7fffffffL
  314.  
  315. /* various character constants and defines for TTY's */
  316. #define MiNTEOF 0x0000ff1a    /* 1a == ^Z */
  317.  
  318. /* defines for tty_read */
  319. #define RAW    0
  320. #define COOKED    0x1
  321. #define NOECHO    0
  322. #define ECHO    0x2
  323. #define ESCSEQ    0x04        /* cursor keys, etc. get escape sequences */
  324.  
  325. /* constants for Fcntl calls */
  326. #define F_DUPFD        0        /* handled by kernel */
  327. #define F_GETFD        1        /* handled by kernel */
  328. #define F_SETFD        2        /* handled by kernel */
  329. #    define FD_CLOEXEC    1    /* close on exec flag */
  330.  
  331. #define F_GETFL        3        /* handled by kernel */
  332. #define F_SETFL        4        /* handled by kernel */
  333. #define F_GETLK        5
  334. #define F_SETLK        6
  335. #define F_SETLKW    7
  336.  
  337. /* more constants for various Fcntl's */
  338. #define FSTAT        (('F'<< 8) | 0)        /* handled by kernel */
  339. #define FIONREAD    (('F'<< 8) | 1)
  340. #define FIONWRITE    (('F'<< 8) | 2)
  341. #define TIOCGETP    (('T'<< 8) | 0)
  342. #define TIOCSETP    (('T'<< 8) | 1)
  343. #define TIOCSETN    TIOCSETP
  344. #define TIOCGETC    (('T'<< 8) | 2)
  345. #define TIOCSETC    (('T'<< 8) | 3)
  346. #define TIOCGLTC    (('T'<< 8) | 4)
  347. #define TIOCSLTC    (('T'<< 8) | 5)
  348. #define TIOCGPGRP    (('T'<< 8) | 6)
  349. #define TIOCSPGRP    (('T'<< 8) | 7)
  350. #define TIOCFLUSH    (('T'<< 8) | 8)
  351. #define TIOCSTOP    (('T'<< 8) | 9)
  352. #define TIOCSTART    (('T'<< 8) | 10)
  353. #define TIOCGWINSZ    (('T'<< 8) | 11)
  354. #define TIOCSWINSZ    (('T'<< 8) | 12)
  355. #define TIOCGXKEY    (('T'<< 8) | 13)
  356. #define TIOCSXKEY    (('T'<< 8) | 14)
  357. #define TIOCIBAUD    (('T'<< 8) | 18)
  358. #define TIOCOBAUD    (('T'<< 8) | 19)
  359. #define TIOCCBRK    (('T'<< 8) | 20)
  360. #define TIOCSBRK    (('T'<< 8) | 21)
  361. #define TIOCGFLAGS    (('T'<< 8) | 22)
  362. #define TIOCSFLAGS    (('T'<< 8) | 23)
  363. #define TIOCOUTQ    (('T'<< 8) | 24)
  364.  
  365. /* cursor control Fcntls:
  366.  * NOTE THAT THESE MUST BE TOGETHER
  367.  */
  368. #define TCURSOFF    (('c'<< 8) | 0)
  369. #define TCURSON        (('c'<< 8) | 1)
  370. #define TCURSBLINK    (('c'<< 8) | 2)
  371. #define TCURSSTEADY    (('c'<< 8) | 3)
  372. #define TCURSSRATE    (('c'<< 8) | 4)
  373. #define TCURSGRATE    (('c'<< 8) | 5)
  374.  
  375. /* process stuff */
  376. #define PPROCADDR    (('P'<< 8) | 1)
  377. #define PBASEADDR    (('P'<< 8) | 2)
  378. #define PCTXTSIZE    (('P'<< 8) | 3)
  379. #define PSETFLAGS    (('P'<< 8) | 4)
  380. #define PGETFLAGS    (('P'<< 8) | 5)
  381. #define PTRACESFLAGS    (('P'<< 8) | 6)
  382. #define PTRACEGFLAGS    (('P'<< 8) | 7)
  383. #    define    P_ENABLE    (1 << 0)    /* enable tracing */
  384. #ifdef NOTYETDEFINED
  385. #    define    P_DOS        (1 << 1)    /* trace DOS calls - unimplemented */
  386. #    define    P_BIOS        (1 << 2)    /* trace BIOS calls - unimplemented */
  387. #    define    P_XBIOS        (1 << 3)    /* trace XBIOS calls - unimplemented */
  388. #endif
  389.  
  390. #define PTRACEGO    (('P'<< 8) | 8)    /* these 4 must be together */
  391. #define PTRACEFLOW    (('P'<< 8) | 9)
  392. #define PTRACESTEP    (('P'<< 8) | 10)
  393. #define PTRACE11    (('P'<< 8) | 11)
  394. #define PLOADINFO    (('P'<< 8) | 12)
  395. #define    PFSTAT        (('P'<< 8) | 13)
  396.  
  397. struct ploadinfo {
  398.     /* passed */
  399.     short fnamelen;
  400.     /* returned */
  401.     char *cmdlin, *fname;
  402. };
  403.  
  404.  
  405. #define SHMGETBLK    (('M'<< 8) | 0)
  406. #define SHMSETBLK    (('M'<< 8) | 1)
  407.  
  408. /* terminal control constants (tty.sg_flags) */
  409. #define T_CRMOD        0x0001
  410. #define T_CBREAK    0x0002
  411. #define T_ECHO        0x0004
  412. /* #define T_XTABS    0x0008  unimplemented*/
  413. #define T_RAW        0x0010
  414. /* #define T_LCASE    0x0020  unimplemented */
  415.  
  416. #define T_NOFLSH    0x0040        /* don't flush buffer when signals
  417.                        are received */
  418. #define T_TOS        0x0080
  419. #define T_TOSTOP    0x0100
  420. #define T_XKEY        0x0200        /* Fread returns escape sequences for
  421.                        cursor keys, etc. */
  422. /* 0x0400 and 0x0800 still available */
  423. #define T_TANDEM    0x1000
  424. #define T_RTSCTS    0x2000
  425. #define T_EVENP        0x4000        /* EVENP and ODDP are mutually exclusive */
  426. #define T_ODDP        0x8000
  427.  
  428. #define TF_FLAGS    0xF000
  429.  
  430. /* some flags for TIOC[GS]FLAGS */
  431. #define TF_STOPBITS    0x0003
  432. #define TF_1STOP    0x0001
  433. #define TF_15STOP    0x0002
  434. #define    TF_2STOP    0x0003
  435.  
  436. #define TF_CHARBITS    0x000C
  437. #define TF_8BIT        0
  438. #define TF_7BIT        0x4
  439. #define TF_6BIT        0x8
  440. #define TF_5BIT        0xC
  441.  
  442. /* the following are terminal status flags (tty.state) */
  443. /* (the low byte of tty.state indicates a part of an escape sequence still
  444.  * hasn't been read by Fread, and is an index into that escape sequence)
  445.  */
  446. #define TS_ESC        0x00ff
  447. #define TS_HOLD        0x1000        /* hold (e.g. ^S/^Q) */
  448. #define TS_COOKED    0x8000        /* interpret control chars */
  449.  
  450. /* structures for terminals */
  451. struct tchars {
  452.     char t_intrc;
  453.     char t_quitc;
  454.     char t_startc;
  455.     char t_stopc;
  456.     char t_eofc;
  457.     char t_brkc;
  458. };
  459.  
  460. struct ltchars {
  461.     char t_suspc;
  462.     char t_dsuspc;
  463.     char t_rprntc;
  464.     char t_flushc;
  465.     char t_werasc;
  466.     char t_lnextc;
  467. };
  468.  
  469. struct sgttyb {
  470.     char sg_ispeed;
  471.     char sg_ospeed;
  472.     char sg_erase;
  473.     char sg_kill;
  474.     ushort sg_flags;
  475. };
  476.  
  477. struct winsize {
  478.     short    ws_row;
  479.     short    ws_col;
  480.     short    ws_xpixel;
  481.     short    ws_ypixel;
  482. };
  483.  
  484. struct xkey {
  485.     short    xk_num;
  486.     char    xk_def[8];
  487. };
  488.  
  489. struct tty {
  490.     short        pgrp;        /* process group of terminal */
  491.     short        state;        /* terminal status, e.g. stopped */
  492.     short        use_cnt;    /* number of times terminal is open */
  493.     short        res1;        /* reserved for future expansion */
  494.     struct sgttyb     sg;
  495.     struct tchars     tc;
  496.     struct ltchars     ltc;
  497.     struct winsize    wsiz;
  498.     long        rsel;        /* selecting process for read */
  499.     long        wsel;        /* selecting process for write */
  500.     char        *xkey;        /* extended keyboard table */
  501.     long        resrvd[3];    /* for future expansion */
  502. };
  503.  
  504. /* Dcntl constants and types */
  505. #define DEV_NEWTTY    0xde00
  506. #define DEV_NEWBIOS    0xde01
  507. #define DEV_INSTALL    0xde02
  508.  
  509. struct dev_descr {
  510.     DEVDRV    *driver;
  511.     short    dinfo;
  512.     short    flags;
  513.     struct tty *tty;
  514.     long    reserved[4];
  515. };
  516.  
  517.  
  518. #define FS_INSTALL    0xf001  /* let the kernel know about the file system */
  519. #define FS_MOUNT      0xf002  /* make a new directory for a file system */
  520. #define FS_UNMOUNT    0xf003  /* remove a directory for a file system */
  521. #define FS_UNINSTALL  0xf004  /* remove a file system from the list */
  522.  
  523.  
  524. struct fs_descr
  525. {
  526.     FILESYS *file_system;
  527.     short dev_no;    /* this is filled in by MiNT if arg == FS_MOUNT*/
  528.     long flags;
  529.     long reserved[4];
  530. };
  531.  
  532.  
  533. /* number of BIOS drives */
  534. #define NUM_DRIVES 32
  535.  
  536. #define BIOSDRV (NUM_DRIVES)
  537. #define PIPEDRV (NUM_DRIVES+1)
  538. #define PROCDRV (NUM_DRIVES+2)
  539. #define SHMDRV    (NUM_DRIVES+3)
  540.  
  541. #define UNI_NUM_DRVS (NUM_DRIVES+4)
  542. #define UNIDRV    ('U'-'A')
  543.  
  544. #define PSEUDODRVS ((1L<<UNIDRV))
  545.  
  546. /* various fields for the "rdev" device numbers */
  547. #define BIOS_DRIVE_RDEV     0x0000
  548. #define BIOS_RDEV    0x0100
  549. #define FAKE_RDEV    0x0200
  550. #define PIPE_RDEV    0x7e00
  551. #define UNK_RDEV    0x7f00
  552. #define PROC_RDEV_BASE    0xa000
  553.  
  554. #ifndef GENMAGIC
  555. /* external variables */
  556.  
  557. extern FILESYS *drives[NUM_DRIVES];
  558. extern struct tty default_tty;
  559. extern char follow_links[];
  560. #endif
  561.  
  562. /* internal bios file structure */
  563.  
  564. #define    BNAME_MAX    13
  565.  
  566. struct bios_file {
  567.     char     name[BNAME_MAX+1];    /* device name */
  568.     DEVDRV *device;            /* device driver for device */
  569.     short    private;        /* extra info for device driver */
  570.     ushort    flags;            /* flags for device open */
  571.     struct tty *tty;        /* tty structure (if appropriate) */
  572.     struct bios_file *next;
  573.     short    lockpid;        /* owner of the lock */
  574.     XATTR    xattr;            /* guess what... */
  575. };
  576.  
  577. #endif /* _filesys_h */
  578.